package ejb.entities;

import java.io.Serializable;

import javax.persistence.*;

import java.util.Date;

/**
 * The persistent class for the user_pack database table.
 * 
 */
@Entity
@Table(name = "user_pack")
@NamedQueries({
	@NamedQuery(name = "UserPack.findAll", query = "SELECT u FROM UserPack u"),
	@NamedQuery(name = "UserPack.findByUserAndP", query = "SELECT u FROM UserPack u WHERE u.pack.packsid LIKE :pid AND u.user.userid LIKE :uid") })
public class UserPack implements Serializable {
	private static final long serialVersionUID = 1L;
	
	public static final String FINDBYUSERP = "UserBasicproduct.findByUserAndP";


	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	@Temporal(TemporalType.DATE)
	private Date date;

	// bi-directional many-to-one association to Pack
	@ManyToOne
	@JoinColumn(name = "packid")
	private Pack pack;

	// bi-directional one-to-one association to User
	@OneToOne
	@PrimaryKeyJoinColumn(name = "userid")
	// readonly
	private User user;

	public UserPack() {
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Pack getPack() {
		return this.pack;
	}

	public void setPack(Pack pack) {
		this.pack = pack;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}